package com.itstyle.seckill.util.statusflow;

import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lifujun
 * @description: 标电按钮处理类
 * @date 2023/9/5 16:22
 */
@Service
@BigOrderButtonClassificationType({BigOrderClassificationEnum.MALL,BigOrderClassificationEnum.VIRTUAL})
public class StandardMallOrderButtonService {

    /**
     * 待付款
     * @param order
     * @return
     */
    @BigOrderButtonStatusType(BigOrderStatusEnum.WAIT_PAY)
    public List<OrderButtonVo> genWaitPayButton(Object order){

        ArrayList<OrderButtonVo> buttonVos = Lists.newArrayList();
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.CANCEL_ORDER.getName())
                .type(OrderButtonType.CANCEL_ORDER.getValue())
                .build());
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(true)
                .text(OrderButtonType.GO_PAY.getName())
                .type(OrderButtonType.GO_PAY.getValue())
                .build());
        return buttonVos;
    }

    /**
     * 待发货
     * @param order
     * @return
     */
    @BigOrderButtonStatusType(BigOrderStatusEnum.WAIT_SHIPPING )
    public List<OrderButtonVo> genWaitShippingButton(Object order){

        ArrayList<OrderButtonVo> buttonVos = Lists.newArrayList();
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.NOTIFY_SHIP.getName())
                .type(OrderButtonType.NOTIFY_SHIP.getValue())
                .build());
        return buttonVos;
    }

    /**
     * 待收货
     * @param order
     * @return
     */
    @BigOrderButtonStatusType({BigOrderStatusEnum.SHIPPED,BigOrderStatusEnum.PART_SHIPPED} )
    public List<OrderButtonVo> genDeliveredButton(Object order){

        ArrayList<OrderButtonVo> buttonVos = Lists.newArrayList();
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.DELAY_RECEIVE.getName())
                .type(OrderButtonType.DELAY_RECEIVE.getValue())
                .build());
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.SHOW_EXPRESS.getName())
                .type(OrderButtonType.SHOW_EXPRESS.getValue())
                .build());
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(true)
                .text(OrderButtonType.SURE_RECEIVE.getName())
                .type(OrderButtonType.SURE_RECEIVE.getValue())
                .build());
        return buttonVos;
    }

    /**
     * 交易完成 交易完结
     * @param order
     * @return
     */
    @BigOrderButtonStatusType({BigOrderStatusEnum.DONE,BigOrderStatusEnum.FINISH} )
    public List<OrderButtonVo> genDoneButton(Object order){

        ArrayList<OrderButtonVo> buttonVos = Lists.newArrayList();
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.DELETE_ORDER.getName())
                .type(OrderButtonType.DELETE_ORDER.getValue())
                .build());
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.EVALUATE.getName())
                .type(OrderButtonType.EVALUATE.getValue())
                .build());
        return buttonVos;
    }

    /**
     * 交易关闭
     * @param order
     * @return
     */
    @BigOrderButtonStatusType(BigOrderStatusEnum.CLOSE )
    public List<OrderButtonVo> genCloseButton(Object order){

        ArrayList<OrderButtonVo> buttonVos = Lists.newArrayList();
        buttonVos.add(OrderButtonVo.builder()
                .isPrimary(false)
                .text(OrderButtonType.DELETE_ORDER.getName())
                .type(OrderButtonType.DELETE_ORDER.getValue())
                .build());
        return buttonVos;
    }


}
